package com.example.springmvc.config;

import java.lang.annotation.*;

/**
 * 标记会话用户
 *
 * @author 凡行
 */
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SessionUser {
    String SESSION_ATTR_NAME = "jwt-userid";

    /**
     * 是否必须带有 RequestAttr[jwt-userid]
     * <br>
     * <i>使用此注解, 获取 RequestAttr[jwt-userid], 将直接 throw AuthorizationException</i>
     *
     * @return 默认true
     */
    boolean required() default true;
}
